﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Solidi;

namespace Solidi.Tests
{
	public static class MockExtensions
	{
		public static IEnumerable<Mock<TType>> MockAll<TType>(this IDependencyBuilder source)
		{
			source.Decorate(e => e.Select(d => new Mock<TType>(d)).ToArray());

			return source.Dependencies.Cast<Mock<TType>>();
		}

		public static Mock<TType> Mock<TType>(this IDependencyBuilder source)
		{
			return MockAll<TType>(source).Single();
		}
	}
}
